/**
 * 
 */
package com.cipe.cmrs.bean;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;

import com.cipe.cmrs.util.StringUtils;
import com.cipe.cmrs.util.Util;

/**
 * @author Incepio
 */
public class CipeprojectBean {
    private String nedIdentifier;
    private String donorName;
    private String donorAwardNumber;
    private String title;
    private String costCenterNumber;
    private Map<String, String> donoraward;
    // For payment request lines
    private Integer id;
    private String projectType;
    private String projectId;
    private String status;
    private String region;
    private String country;
    private String acronym;
    private String formattedStartDate;
    private String formattedEndDate;
    private Date startDate;
    private Date endDate;
    private String partnerName;
    private boolean override;
    private BigDecimal managementFunds = BigDecimal.ZERO;
    private BigDecimal partnerGrantFunds = BigDecimal.ZERO;
    private BigDecimal remainingFunds = BigDecimal.ZERO;
    private boolean partnerGrant;
    private Date donorAwardStartDate;
    private Date donorAwardEndDate;
    private BigDecimal riskAssessmentScore;
    private String programOfficer;
    private String programAssistant;
    private String seniorProgramOfficer;

    public String getNedIdentifier() {
        return nedIdentifier;
    }

    public void setNedIdentifier(String nedIdentifier) {
        this.nedIdentifier = nedIdentifier;
    }

    public String getEscapedDonorName() {
        return StringUtils.INSTANCE.escape(donorName);
    }

    public String getDonorName() {
        return donorName;
    }

    public void setDonorName(String donorName) {
        this.donorName = donorName;
    }

    public String getDonorAwardNumber() {
        return donorAwardNumber;
    }

    public void setDonorAwardNumber(String donorAwardNumber) {
        this.donorAwardNumber = donorAwardNumber;
    }

    public String getEscapedTitle() {
        return StringUtils.INSTANCE.escape(title);
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCostCenterNumber() {
        return costCenterNumber;
    }

    public void setCostCenterNumber(String costCenterNumber) {
        this.costCenterNumber = costCenterNumber;
    }

    public Map<String, String> getDonoraward() {
        return donoraward;
    }

    public void setDonoraward(Map<String, String> donoraward) {
        this.donoraward = donoraward;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getProjectType() {
        return projectType;
    }

    public void setProjectType(String projectType) {
        this.projectType = projectType;
    }

    public String getProjectId() {
        return projectId;
    }

    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getEscapedRegion() {
        return StringUtils.INSTANCE.escape(region);
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getEscapedCountry() {
        return StringUtils.INSTANCE.escape(country);
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getEscapedAcronym() {
        return StringUtils.INSTANCE.escape(acronym);
    }

    public String getAcronym() {
        return acronym;
    }

    public void setAcronym(String acronym) {
        this.acronym = acronym;
    }

    public String getFormattedStartDate() {
        return formattedStartDate;
    }

    public void setFormattedStartDate(String formattedStartDate) {
        this.formattedStartDate = formattedStartDate;
    }

    public String getFormattedEndDate() {
        return formattedEndDate;
    }

    public void setFormattedEndDate(String formattedEndDate) {
        this.formattedEndDate = formattedEndDate;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getEscapedPartnerName() {
        return StringUtils.INSTANCE.escape(partnerName);
    }

    public String getPartnerName() {
        return partnerName;
    }

    public void setPartnerName(String partnerName) {
        this.partnerName = partnerName;
    }

    public boolean isOverride() {
        return override;
    }

    public void setOverride(boolean override) {
        this.override = override;
    }

    public BigDecimal getManagementFunds() {
        return managementFunds;
    }

    public void setManagementFunds(BigDecimal managementFunds) {
        this.managementFunds = managementFunds;
    }

    public BigDecimal getPartnerGrantFunds() {
        return partnerGrantFunds;
    }

    public void setPartnerGrantFunds(BigDecimal partnerGrantFunds) {
        this.partnerGrantFunds = partnerGrantFunds;
    }

    public BigDecimal getTotalFunds() {
        return managementFunds.add(partnerGrantFunds);
    }

    public BigDecimal getRemainingFunds() {
        return remainingFunds;
    }

    public void setRemainingFunds(BigDecimal remainingFunds) {
        this.remainingFunds = remainingFunds;
    }

    public boolean isPartnerGrant() {
        return partnerGrant;
    }

    public void setPartnerGrant(boolean partnerGrant) {
        this.partnerGrant = partnerGrant;
    }

    public Date getDonorAwardStartDate() {
        return donorAwardStartDate;
    }

    public void setDonorAwardStartDate(Date donorAwardStartDate) {
        this.donorAwardStartDate = donorAwardStartDate;
    }

    public Date getDonorAwardEndDate() {
        return donorAwardEndDate;
    }

    public void setDonorAwardEndDate(Date donorAwardEndDate) {
        this.donorAwardEndDate = donorAwardEndDate;
    }

    public BigDecimal getRiskAssessmentScore() {
        return riskAssessmentScore;
    }

    public void setRiskAssessmentScore(BigDecimal riskAssessmentScore) {
        this.riskAssessmentScore = riskAssessmentScore;
    }

    public String getDisplayName() {
        String outcome = Util.concate(
            new String[]{ getValue(projectId),
                getValue(projectType),
                getValue(status),
                getValue(getEscapedPartnerName()),
                getValue(getEscapedTitle()),
                getValue(formattedStartDate),
                getValue(formattedEndDate),
                getValue(remainingFunds.toPlainString()), }, " | ");
        return outcome.length() > 110 ? outcome.substring(0, 109) : outcome;
    }

    private String getValue(String val) {
        if (org.apache.commons.lang.StringUtils.isNotBlank(val)) {
            return val;
        } else {
            return "";
        }
    }

	public String getProgramOfficer() {
		return programOfficer;
	}

	public void setProgramOfficer(String programOfficer) {
		this.programOfficer = programOfficer;
	}

	public String getProgramAssistant() {
		return programAssistant;
	}

	public void setProgramAssistant(String programAssistant) {
		this.programAssistant = programAssistant;
	}

	public String getSeniorProgramOfficer() {
		return seniorProgramOfficer;
	}

	public void setSeniorProgramOfficer(String seniorProgramOfficer) {
		this.seniorProgramOfficer = seniorProgramOfficer;
	}

}
